package com.bluesky.drcp.persistence.dao.hibernate;

import java.util.Iterator;
import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.bluesky.drcp.business.UserRole;
import com.bluesky.drcp.persistence.dao.UserRoleDao;

public class UserRoleDaoImpl extends HibernateDaoSupport implements UserRoleDao {
	public List getRoleList(String userId) {

		return getHibernateTemplate().find(
				"select r from Role r, UserRole ur where ur.userId=? and r.id=ur.roleId", userId);

	}	

	public void delete(String userId) {		
		getHibernateTemplate().bulkUpdate("delete from UserRole userRole where userRole.userId=?",userId);		
	}

	public void save(UserRole userRole) {
		getHibernateTemplate().save(userRole);		
	}
	
	
}
